﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <LinearGradientBrush x:Key="whiteBackBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Offset="0" Color="#80FFFFFF" />
        <GradientStop Offset="1" Color="#80F0F0FB" />
    </LinearGradientBrush>

    <SolidColorBrush x:Key="CheckBoxFillNormal" Color="#F4F4F4"/>
    <SolidColorBrush x:Key="CheckBoxStroke" Color="#8E8F8F"/>

    <Style x:Key="EmptyCheckBoxFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="1" SnapsToDevicePixels="true"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="CheckRadioFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="14,0,0,0" SnapsToDevicePixels="true"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="NoBorderCheckBoxStyle" TargetType="{x:Type CheckBox}">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Background" Value="{StaticResource CheckBoxFillNormal}"/>
        <Setter Property="BorderBrush" Value="{StaticResource CheckBoxStroke}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource EmptyCheckBoxFocusVisual}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">
                    <BulletDecorator SnapsToDevicePixels="true" Background="Transparent">
                        <BulletDecorator.Bullet>
                            <Canvas x:Name="canvas"  Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5">
                                <Path Fill="{x:Null}" Stretch="Fill" Stroke="{TemplateBinding Foreground}" 
                                          StrokeThickness="2" Data="M3.4301162,7.8764534 L5.4997659,13.500455 13.499766,0.67321938" />
                            </Canvas>
                        </BulletDecorator.Bullet>
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True"/>
                    </BulletDecorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasContent" Value="true">
                            <Setter Property="FocusVisualStyle" Value="{StaticResource CheckRadioFocusVisual}"/>
                            <Setter Property="Padding" Value="4,0,0,0"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="False">
                            <Setter Property="Visibility" TargetName="canvas" Value="Hidden" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="toggleBlueButtonStyle" TargetType="ToggleButton">
        <Setter Property="Padding" Value="20,0" />
        <Setter Property="Margin" Value="5" />
        <Setter Property="MinHeight" Value="25" />
        <Setter Property="MinWidth" Value="50" />
        <Setter Property="Foreground" Value="White" />
        <Setter Property="FocusVisualStyle">
            <Setter.Value>
                <Style>
                    <Setter Property="Control.Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Rectangle RadiusX="10" RadiusY="10" Stroke="Gold" StrokeThickness="1" />
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid x:Name="rootGrid" RenderTransformOrigin=".5,.5">
                        
                        <Grid.Resources>
                            <SolidColorBrush x:Key="borderBrush" Color="Transparent" />
                         </Grid.Resources>
                        
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition To="MouseOver" 
                                                      GeneratedDuration="0:0:0.0" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ColorAnimation To="DarkRed"
                                                        Storyboard.TargetName="bottomBorder" 
                                                        Storyboard.TargetProperty="(Shape.Fill).GradientStops[0].Color" 
                                                        Duration="0:0:0.25" />
                                        <ColorAnimation To="Black" 
                                                        Storyboard.TargetName="bottomBorder" 
                                                        Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" 
                                                        Duration="0:0:0" />
                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="Normal">
                                    <Storyboard>
                                        <ColorAnimation To="#FF043F76"
                                                        Storyboard.TargetName="bottomBorder" 
                                                        Storyboard.TargetProperty="(Shape.Fill).GradientStops[0].Color" 
                                                        Duration="0:0:0.25" />
                                        <ColorAnimation To="Transparent" 
                                                        Storyboard.TargetName="bottomBorder" 
                                                        Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" 
                                                        Duration="0:0:0" />
                                    </Storyboard>
                                </VisualState>

                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid.RenderTransform>
                            <TranslateTransform X="0" Y="0"/>
                        </Grid.RenderTransform>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Rectangle Grid.RowSpan="2" x:Name="bottomBorder" RadiusX="10" RadiusY="10" Stroke="{StaticResource borderBrush}" StrokeThickness="2">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                                    <GradientStop Color="#FF043F76" Offset="0"/>
                                    <GradientStop Color="#FF04427C" Offset="1"/>
                                    <GradientStop Color="#FF5F91C1" Offset="1"/>
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle x:Name="highlight" Margin="2.5" Fill="White" RadiusX="10" RadiusY="10">
                            <Rectangle.OpacityMask>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Color="#D0FFFFFF" Offset="0"/>
                                    <GradientStop Color="#00FFFFFF" Offset="1"/>
                                </LinearGradientBrush>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                        <ContentPresenter Grid.RowSpan="2"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                            Margin="{TemplateBinding Padding}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                            RecognizesAccessKey="True" RenderTransformOrigin="0.5,0.5" x:Name="contentPresenter" />
                    </Grid>
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="buttonDown_Animation">
                            <DoubleAnimation Storyboard.TargetName="rootGrid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)"
							                 From="0" To="0" Duration="0:0:0" />
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Visibility" TargetName="highlight" Value="Hidden"/>
                            <Setter Property="Stroke" TargetName="bottomBorder" Value="Gold"/>
                            <Setter Property="Fill" TargetName="bottomBorder">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0,0" StartPoint="0,1">
                                        <GradientStop Color="#FF0C4E8B" Offset="0"/>
                                        <GradientStop Color="#FF2B4864" Offset="0.42"/>
                                        <GradientStop Color="Black" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Visibility" TargetName="highlight" Value="Hidden"/>
                            <Setter Property="Stroke" TargetName="bottomBorder" Value="Black"/>
                            <Setter Property="Fill" TargetName="bottomBorder">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0,0" StartPoint="0,1">
                                        <GradientStop Color="#FF0C4E8B" Offset="0"/>
                                        <GradientStop Color="#FF2B4864" Offset="0.42"/>
                                        <GradientStop Color="Black" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="bottomBorder" Property="Fill" Value="DarkGray" />
                            <Setter TargetName="bottomBorder" Property="Stroke" Value="Silver" />
                            <Setter TargetName="bottomBorder" Property="StrokeThickness" Value="4" />
                            <Setter TargetName="highlight" Property="Fill" Value="#20FFFFFF" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ImageBrush x:Key="WindowBackground" Stretch="Fill" 
                    ImageSource="images/Wave.jpg" />

</ResourceDictionary>